package com.tfswue.jqr.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.tfswue.jqr.mapper")
public class MyBatisPlusConfig {
    // 查询 100条数据， 分10页。 1页10条数据
    // select * from user limit 10
    /*
    * Page={currentnum当前页面1，当前页面记录10，所有页数10，当前页数据10}
    *
    * */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }
}
